
package com.thinkgem.jeesite.common.component.redis.element;

import redis.clients.jedis.Jedis;

import com.thinkgem.jeesite.common.component.redis.service.PPrintListener;

/** 
 * 放置rds的订阅类元素操作
 *
 */
public class RdsSubscribe{

	public RdsSubscribe(Jedis jedis, PPrintListener listener) {
	    this.jedis = jedis;
	    this.listener = listener;
    }

	public Jedis getJedis() {
    	return jedis;
    }

	public void setJedis(Jedis jedis) {
    	this.jedis = jedis;
    }

	public PPrintListener getListener() {
    	return listener;
    }

	public void setListener(PPrintListener listener) {
    	this.listener = listener;
    }

	public void sub(String channel){
		jedis.subscribe(listener, channel);
	}
	
	public void unsub(String channel){
		listener.unsubscribe(channel);
	}

	private Jedis jedis;//当前客户端
	private PPrintListener listener;//发布与订阅使用的单listener
}
